<template>
  <a-card>
    <a-form :form="form">
      <a-form-item label="贷款需知">
        <wang-editor ref="wang" @edchange="change" v-model="ggnr" v-decorator="['ggnr',
          {
            rules: [{ required: false, message: '请输入贷款需知!' }],
          }
        ]" :isClear="isClear"/>
      </a-form-item>
    </a-form>
    <a-button type="primary" @click="save()">
        保存 
    </a-button>
  </a-card>
</template>

<script>
import { STable } from '~'
import { mapState } from 'vuex'
import wangEditor from './component/wangEditor'

export default {
    data () {
        return {
            isClear: true,
            ggnr:''
        }
    },
    components: { wangEditor },
    beforeCreate () {
        this.form = this.$form.createForm(this)
    },
    created(){
        this.getContent()
    },
    methods:{
        change(e){
            this.ggnr = e
        },
        getContent(){
            this.$api.student.studentloanXzList().then(res => {
                this.ggnr = res.data.notice
                console.log(this.ggnr)
                this.$refs.wang.editor.txt.html(res.data.notice)
            })
        },
        save(){
            this.form.validateFields((err, values) => {
                let params = Object.assign({},{notice:this.ggnr})
                this.$api.student.studentloanXzSave(params).then(res => {
                    this.$message.success(res.msg)
                })
                
            })
            // console.log(this.ggnr)
            
            
        }
    }
    
}
</script>

<style>

</style>